home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / objc / List.h < prev    next >
Text File  |  1991-11-26  |  2KB  |  97 lines

  1. /*
  2.     List.h
  3.     Copyright 1988, 1989 NeXT, Inc.
  4.  
  5.     DEFINED AS:    A common class
  6.     HEADER FILES:    objc/List.h
  7.  
  8. */
  9.  
  10. #ifndef _OBJC_LIST_H_
  11. #define _OBJC_LIST_H_
  12.  
  13. #import <objc/Object.h>
  14. #import <objc/typedstream.h>
  15.  
  16. @interface List : Object
  17. {
  18. @public
  19.     id         *dataPtr;    /* data of the List object */
  20.     unsigned     numElements;    /* Actual number of elements */
  21.     unsigned     maxElements;    /* Total allocated elements */
  22. }
  23.  
  24. /* Creating, freeing */
  25.  
  26. - free;
  27. - freeObjects;
  28. - copyFromZone:(NXZone *)zone;
  29.   
  30. /* Initializing */
  31.  
  32. - init;
  33. - initCount:(unsigned)numSlots;
  34.  
  35. /* Comparing two lists */
  36.  
  37. - (BOOL)isEqual: anObject;
  38.   
  39. /* Managing the storage capacity */
  40.  
  41. - (unsigned)capacity;
  42. - setAvailableCapacity:(unsigned)numSlots;
  43.  
  44. /* Manipulating objects by index */
  45.  
  46. - (unsigned)count;
  47. - objectAt:(unsigned)index;
  48. - lastObject;
  49. - addObject:anObject;
  50. - insertObject:anObject at:(unsigned)index;
  51. - removeObjectAt:(unsigned)index;
  52. - removeLastObject;
  53. - replaceObjectAt:(unsigned)index with:newObject;
  54. - appendList: (List *)otherList;
  55.  
  56. /* Manipulating objects by id */
  57.  
  58. - (unsigned)indexOf:anObject;
  59. - addObjectIfAbsent:anObject;
  60. - removeObject:anObject;
  61. - replaceObject:anObject with:newObject;
  62.  
  63. /* Emptying the list */
  64.  
  65. - empty;
  66.  
  67. /* Archiving */
  68.  
  69. - write:(NXTypedStream *)stream;
  70. - read:(NXTypedStream *)stream;
  71.  
  72. /* Sending messages to elements of the list */
  73.  
  74. - makeObjectsPerform:(SEL)aSelector;
  75. - makeObjectsPerform:(SEL)aSelector with:anObject;
  76.  
  77. /*
  78.  * The following new... methods are now obsolete.  They remain in this 
  79.  * interface file for backward compatibility only.  Use Object's alloc method 
  80.  * and the init... methods defined in this class instead.
  81.  */
  82.  
  83. + new;
  84. + newCount:(unsigned)numSlots;
  85.  
  86. @end
  87.  
  88. typedef struct {
  89.     @defs(List)
  90. } NXListId;
  91.  
  92. #define NX_ADDRESS(x) (((NXListId *)(x))->dataPtr)
  93.  
  94. #define NX_NOT_IN_LIST    0xffffffff
  95.  
  96. #endif /* _OBJC_LIST_H_ */
  97.